package com.cy.pj.sys.controller;

import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.common.pojo.PageObject;
import com.cy.pj.sys.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author 张琪
 * @date 2020/11/13
 * @describe
 */

@Controller
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    @ResponseBody
    @GetMapping("log/doFindPageObjects")
    public JsonResult doFindPageObjects(String username, Integer pageCurrent){
        PageObject pageObject = sysLogService.findPageObjects(username, pageCurrent);
        return new JsonResult(pageObject);
    }

    @ResponseBody
    @RequestMapping("/log/doDeleteObjects")
    public JsonResult doDeleteObjects(Integer[] ids){
        int rows = sysLogService.doDeleteObjects(ids);
        if(rows == 0)
            return new JsonResult("delete fault");
        return new JsonResult("delete Ok");
    }
}
